#
# @lc app=leetcode.cn id=2427 lang=python3
#
# [2427] 公因子的数目
#

# @lc code=start
class Solution:
    def commonFactors(self, a: int, b: int) -> int:
        gcd_num = math.gcd(a, b)
        return sum(gcd_num % i == 0  for i in range(1, gcd_num+1))
# @lc code=end

